<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org">

<head th:substituteby="header :: copy"></head>

<body>

	<h1>Exceptions Demo 4</h1>
	<h2>Optional Simple Mapping Exception Resolver</h2>

	<h3>Summary</h3>
	<ul>
		<li>Demo running with profiles: <i th:text="${profiles}">profiles</i></li>

		<li th:switch="${profiles}">
			<i th:text="${profiles}">PROFILE-NAME</i>:
			Exceptions not handled elsewhere are 

			<!-- NONE Profile enabled -->
			<span th:case="'none'">handled by container. </span>

			<!-- JAVA Profile enabled -->
			<span th:case="'java-config'">passed to a <code>SimpleMappingExceptionResolver</code>
				created via Java Configuration - see <code>ExceptionConfiguration</code>.
			</span>

			<!-- XML Profile enabled -->
			<span th:case="'xml-config'">passed to a <code>SimpleMappingExceptionResolver</code>
				created via XML Configuration - see <code>mvc-configuration.xml</code>.
			</span>

			<!-- DEMO Profile enabled -->
			<span th:case="'demo-config'">passed to a switchable <code>SimpleMappingExceptionResolver</code>
				that may or may not choose to handle the exception - see <code>DemoExceptionConfiguration</code>.
				<br/>
				>> Switch state = <i th:text="${switchState}">on/off</i>.
				<span th:switch="${switchState}">
					Resolver is
					<span th:case="'on'">
						enabled (<a href="/simpleMappingExceptionResolver/off">disable</a>)
					</span>
					<span th:case="'off'">
						disabled (<a href="/simpleMappingExceptionResolver/on">enable</a>)
					</span>
				</span>
			</span>
		</li>
		
		<li>See <a th:substituteby="link :: blog"></a> for more details.
		</li>
	</ul>

	<h3>Details</h3>
	<p>The exceptions below have no handler defined for them when
		running the <code>demo-config</code> profile. They will generate the default error-page
		supplied by Spring Boot. A non Spring-Boot application would generate
		the container's error page.</p>

	<p>To fully understand this demo, review the output in the server
		(console) log as you click the links below.</p>

	<h3>Demo</h3>
	<ul class="openlist">

		<li>Throw <a th:href="@{/throw/databaseException}">DatabaseException</a>
			- should generate Spring Boot's error page.
		</li>
		<li>Throw <a th:href="@{/throw/invalidCreditCard}">InvalidCreditCardException</a>
			- should generate Spring Boot's error page.
		</li>
		<li>Throw <a th:href="@{/throw/unhandledException}">UnhandledException</a>
			- should generate Spring Boot's error page.
		</li>
		<li>A genuinely <a th:href="@{/unknown}">Unknown page</a>. There is no
			handler for this URL, so the framework will generate a 404. (No
			exception handler in the application does this, this is the standard
			Spring MVC response to a URL it has no handler for).
		</li>
	</ul>

	<p>
		Demo 5: <a th:href="@{/demo5}">Working with Spring Boot</a>.
	</p>


	<div th:substituteby="footer :: copy"></div>
</body>
</html>
